<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <title>{{ page.title | default: site.title }}</title>

    <link rel="stylesheet" href="{{ '/assets/css/post-style.css?v=' | append: site.github.build_revision | relative_url }}">
    <meta name="viewport" content="width=device-width">
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
  </head>
  <body>
    <div>
      <div class="topbar">
        <div class="topbar-wrapper">
          <span><a href="http://blog.dewdz.com">Dewdz's blog</a><span id="welcom-date">{{ site.time }}</span></span>
        </div>
      </div>

      <div class="context-wrapper">

        <header>
            <h1>{{ page.title }}</h1>
            <p><span>{{ page.date }}</span><span class="margin-left-20">分类：{{ page.categories }}</span></p>
        </header>
        <section>
        {{ content }}
        </section>
        <div class="adjoin-page">
            {% if site.posts.size > 1 %}
                {% assign prevPostTitle = "" %}
                {% assign prevPostUrl = "" %}
                {% assign nextPostIndex = -1 %}
                {% assign curIndex = 0 %}

                {% for post in site.posts %}
                    {% if post.title == page.title %}
                        {% if prevPostTitle != "" %}
                            <p class="prev-page"><a href="{{ prevPostUrl }}">上一篇： {{ prevPostTitle }}</a></p>
                        {% endif %}
                        {% capture nextPostIndex %}{{ forloop.index | plus:1 }}{% endcapture %}
                    {% endif %}

                    {% capture curIndex %}{{ forloop.index | plus:0 }}{% endcapture %}
                    {% if curIndex == nextPostIndex %}
                        <p class="next-page"><a href="{{ post.url }}">下一篇： {{ post.title }}</a></p>
                    {% endif %}

                    {% capture prevPostTitle %}{{ post.title }}{% endcapture %}
                    {% capture prevPostUrl %}{{ post.url }}{% endcapture %}
                {% endfor %}
            {% endif %}
            <div class="clear"></div>
        </div>
    </div>

	    {% include footer.html param="footer post_footer" %}
    </div>
    <script src="{{ '/assets/js/scale.fix.js' | relative_url }}"></script>

  {% if site.google_analytics %}
    <script type="text/javascript">
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script type="text/javascript">
      try {
        var pageTracker = _gat._getTracker("{{ site.google_analytics }}");
        pageTracker._trackPageview();
      } catch(err) {}
    </script>
  {% endif %}
  </body>
</html>
